<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Groups extends MY_Controller {

	function __construct()
	{
		parent::__construct();
		$this->load->library('grocery_CRUD');	
	}
	
	function _page_output($output = null)
	{	
	    $this->data['js_files'] = $output->js_files;
		$this->data['css_files'] = $output->css_files;
		$this->data['output'] = $output->output;		
		$this->render();
	}
	
	function news()
	{
		$output = $this->grocery_crud->render();

		$this->_page_output($output);
	}
	
	function index()
	{
		$this->_page_output((object)array('output' => '' , 'js_files' => array() , 'css_files' => array()));
	}	
	
	function groups_management()
	{
		try{
			$crud = new grocery_CRUD();
			
			$crud->unset_print();
			$crud->unset_export();
			$crud->set_theme('datatables');
			$crud->set_table('groups');
			$crud->set_subject('Groupe');
					
			
			$output = $crud->render();
			
			$this->_page_output($output);
			
		}catch(Exception $e){
			show_error($e->getMessage().' --- '.$e->getTraceAsString());
		}
	}
	
}